<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        
		<script src="<c:url value="/resources/datetimepicker_css.js" />"></script>
    </head>
    <body>
        <form:form modelAttribute="match" method="post" action="/admin/match/edit" >
            <table class="simple">
                <tr>
                    <td>Season</td>
                    <td>
                        <c:out value="${season.name}"/>
                        <br/>
                        <c:out value="${season.startDate}"/> - <c:out value="${season.endDate}"/>
                    </td>
                </tr>
                <tr>
                    <td>Player 1</td>
                    <td>
                        <form:select path="player1Id">
                            <c:forEach var="player" items="${players}">
                                <form:option value="${player.id}">
                                    <c:out value="${player.firstName}"/> <c:out value="${player.lastName}"/>
                                </form:option>
                            </c:forEach>
                        </form:select>
                    </td>
                </tr>
                <tr>
                    <td>Player 2</td>
                    <td>
                        <form:select path="player2Id">
                            <c:forEach var="player" items="${players}">
                                <form:option value="${player.id}">
                                    <c:out value="${player.firstName}"/> <c:out value="${player.lastName}"/>
                                </form:option>
                            </c:forEach>
                        </form:select>
                    </td>
                </tr>
                <tr>
                    <td>Date and Time</td>
                    <td><form:input path="dateAndTime" id="demo1" /><img src="<c:url value="/resources/images/cal.gif" />" onclick="javascript:NewCssCal ('demo1','ddMMyyyy','dropdown',true,'24')" style="cursor:pointer"/></td>
                </tr>
            </table>
            <input type="submit" value="<c:if test="${not empty match.id}" >Edit</c:if><c:if test="${empty match.id}" >Add</c:if>" />
            <br>
            <br>
            <form:errors path="*"/>
        </form:form>
    </body>
</html>
